package org.yjc.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
@Table(name="yjc_tbclass")
public class TbClass {
	private Integer id; //id
	private String className; //班级名
	private String classTeacher; //班主任
	@JsonIgnore
	private List<Student> students=new ArrayList<>();
	
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(length=10)
	public String getClassName() {
		return className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	@Column(length=10)
	public String getClassTeacher() {
		return classTeacher;
	}
	public void setClassTeacher(String classTeacher) {
		this.classTeacher = classTeacher;
	}
	@OneToMany(cascade=CascadeType.ALL,mappedBy="tbClass")
	public List<Student> getStudents() {
		return students;
	}
	public void setStudents(List<Student> students) {
		this.students = students;
	}
	public TbClass(Integer id, String className, String classTeacher) {
		super();
		this.id = id;
		this.className = className;
		this.classTeacher = classTeacher;
	}
	public TbClass() {
		super();
	}
	
	

}
